APPNAME = main

CC = gcc
AR = ar

PRJ_PATH = $(shell pwd)
LIBNAME = $(shell basename ${PRJ_PATH})

CFLAGS = -I ../include/
CFLAGS+= -I ../include/my_include/
CFLAGS+= -I ../include/json


LIB_PATH = ../lib/

LDFLAGS= -L ${LIB_PATH}
LDNAME = -lpthread -lmosquitto -lsqlite3 -liniparser -lcjson -lzlog

all:
	${CC} ${CFLAGS} *.c -o ${APPNAME} ${LDFLAGS} ${LDNAME} 
	#make move
	#make clean

static_lib:
	${CC} ${CFLAGS} -c *.c
	${AR} -rcs lib${LIBNAME}.a *.o

dynamic_lib:
	${CC} -shared -fPIC ${CFLAGS} *.c -o lib${LIBNAME}.so

move:
	mv lib${LIBNAME}.* ${LIB_PATH}

clean:
	rm -rf *.o

